home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Format (UK) 188
/
01-04 PC Format 188 [2006-06] DVD side 1_.iso
/
Menus
/
Scenes
/
HOME.dir
/
00003_Script_GenerateDock Script
< prev
next >
Wrap
Text File
|
2006-04-20
|
3KB
|
143 lines
global dock
global mKey
global mp
global dv
on populateDockCast
repeat with i = 1 to castlib(2).member.count
member(i,2).erase()
end repeat
repeat with i = 1 to castlib("tabs").member.count
member(i, "tabs").erase()
end repeat
repeat with i = 1 to (mKey.count)
ok = baFileExists(mKey[i].pPath & "icon.png")
if ok = 1 then
nm = new(#bitmap, castlib("dock"))
nm.importfileinto(mKey[i].pPath & "icon.png")
nm.name = string(mKey[i].pTitle)
nTab = new(#bitmap, castlib("tabs"))
nTab.importfileinto(mKey[i].pPath & "tab.png")
nTab.name = string(mKey[i].pTitle)
nTab.regpoint = point(0,0)
else
alert("No Icon found for " & mKey[i].pTitle & " in: " & mKey[i].pPath)
quit
end if
end repeat
end
on resetSectionTitle
member("Section_Title").text = "Home"
end
on generateDock
dock = [:]
dock[#bWidth] = 50
dock[#fullWidth] = 80
dock[#widthDif] = dock.fullWidth - dock.bWidth
dock[#bc] = castlib("dock").member.count
dock[#baseWidth] = (dock.bWidth + (dock.bWidth * 2)) * dock.bc
dock[#DistList] = []
dock[#ClosestSp] = 0
dock[#mPos] = vector(0,0,0)
dock[#minDist] = 100
dock[#BiggestBut] = dock.bc / 2
dock[#OffsetVal] = dock.bWidth * 2
repeat with i = 1 to castlib(3).member.count
member(i,3).erase()
end repeat
repeat with i = 1 to _movie.channel.count
if sprite(i).member = member("DockPlaceholder") then
dock[#StartChannel] = i + 1
sprite(i).visible = false
dock[#BaseV] = sprite(i).locV
exit repeat
end if
end repeat
repeat with i = dock.startchannel to _movie.channel.count
sprite(i).scriptinstancelist = []
channel(i).removescriptedsprite()
end repeat
sCen = (the stageright - the stageLeft) / 2
dock[#lPoint] = (sCen - (dock.baseWidth / 4))
chn = 400
lh = dock.lPoint
lv = dock.baseV
ratio = float(dock.bWidth / member(1, "dock").width)
repeat with i = 1 to dock.bc
mKey[i][#DockSp] = sprite(chn)
pos = point(lh, lv)
mem = member(i, "dock")
channel(chn).makescriptedsprite(mem, pos)
sc = script("DockHandler").new()
sprite(chn).scriptInstanceList.add(sc)
sendsprite(chn, #init, pos, i, mKey[i][#pPath], chn)
chn = chn + 1
tm = new(#text, castlib 3 )
tm.fontsize = 18
tm.fontstyle = [#bold]
tm.width = dock.bWidth * 2
tm.antialias = true
tm.antialiasthreshold = 0
tm.alignment = #center
tm.text = member(i, "dock").name
tm.color = rgb(255,255,255)
tpos = point(lh + (tm.Width / 4), (lv + (dock.bWidth / 2)))
channel(chn).makescriptedsprite(tm, tpos)
sprite(chn).ink = 6
lh = lh + dock.OffsetVal
chn = chn + 1
end repeat
end
on upDateDock
if the mouseV > 400 then
Sel = min(Dock.DistList)
repeat with i = 1 to dock.distList.count
if Dock.distList[i] = sel then
Dock.BiggestBut = i
exit repeat
end if
end repeat
end if
end